home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / hint / CheatGuide.lzh / CheatGuide.rexx < prev    next >
OS/2 REXX Batch file  |  1993-04-06  |  3KB  |  101 lines

  1. /*                                                                */
  2. /* Arexx program to create Amiga Games Cheats AmigaGuide database */
  3. /*                                                                */
  4. /* Written by: Dave Lowrey - dwl10@juts.ccc.amdahl.com            */
  5. /*                                                                */
  6. /* Usage: rx CheatGuide infile outfile                            */
  7. /*        infile = The amiga cheats list, edited so that the      */
  8. /*                 line is the name of the first program, and all */
  9. /*                 lines that start out with "_______", other     */
  10. /*                 than the ones separating the program names,    */
  11. /*                 have been deleted.                             */
  12. /*        outfile = The name of the AmigaGuide file that will     */
  13. /*                  contain the output from this program          */
  14. /*                                                                */
  15. /* Also requires that the AmigaDos commands "join" and "delete"   */
  16. /* be available.                                                  */
  17. /*                                                                */
  18. /* Version 1.0 - April 6, 1993                                    */
  19. /*                                                                */
  20.  
  21. tempfilename = "T:cgtemp1"     /* move to disk if you are short on ram */
  22. tempfile2name = "T:cgtemp2"    /* same for this one */
  23. seperator = "______"           /* string that seperates programs in list */
  24.  
  25. parse arg infile outfile
  26.  
  27. infilename=strip(infile)
  28. outfilename=strip(outfile)
  29.  
  30. if length(infilename) = 0 then do
  31.     say "usage: CheatGuide infile tempfile2"
  32.     exit
  33. end
  34. if length(outfilename) = 0 then do
  35.     say "usage: CheatGuide infile outfile"
  36.     exit
  37. end
  38.  
  39. if ~open(tempfile, tempfilename, 'w') then do
  40.     say "Error opening temp file"
  41.     exit
  42. end
  43.  
  44. if ~open(tempfile2, tempfile2name, 'w') then do
  45.     say "Error opening temp file 2"
  46.     address command "delete" tempfilename "quiet"
  47.     exit
  48. end
  49.  
  50. if ~open(infile, infile, 'r') then do
  51.     say "Error opening input file"
  52.     exit
  53. end
  54.  
  55. count = 1
  56. do forever
  57.     line = readln(infile)
  58.     if eof(infile) then break
  59.     line = strip(line)
  60.     line = compress(line, ":")
  61.     if length(line) > 0 then do
  62.         TITLE.count = line
  63.         line = '@node "'TITLE.count'"'
  64.         z = writeln(tempfile, line)
  65.         z = writeln(tempfile, TITLE.count)
  66.         count = count + 1
  67.         do forever
  68.             line = readln(infile)
  69.             if eof(infile) then break
  70.             if substr(line,1,6) = seperator then break
  71.             z = writeln(tempfile, line)
  72.         end
  73.         z = writeln(tempfile,'@endnode')
  74.     end
  75. end
  76. z=close(infile)
  77. z=close(tempfile)
  78.  
  79. z=writeln(tempfile2, '@database "cheats.guide"')
  80. z=writeln(tempfile2, '@remark')
  81. z=writeln(tempfile2, '@remark Database created by CheatGuide.rexx')
  82. z=writeln(tempfile2, '@remark CheatGuide.rexx written by Dave Lowrey')
  83. z=writeln(tempfile2, '@remark dwl10@juts.ccc.amdahl.com')
  84. z=writeln(tempfile2, '@remark')
  85. z=writeln(tempfile2, '@master "cheats"')
  86. z=writeln(tempfile2, '@node Main "Amiga Game Cheats Guide by D. Lowrey"')
  87. z=writeln(tempfile2, " ");
  88. z=writeln(tempfile2, "Table of Contents:")
  89. z=writeln(tempfile2, " ")
  90.  
  91. do i=1 to count-1
  92.     line = '        @{"'TITLE.i'" link "'TITLE.i'"}'
  93.     z=writeln(tempfile2, line)
  94. end
  95.  
  96. z=writeln(tempfile2, '@endnode')
  97. z=close(tempfile2)
  98.  
  99. address command "join" tempfile2name tempfilename "as" outfile
  100. address command "delete" tempfilename tempfile2name "quiet"
  101.